Toolshed common-memory cleanup #317
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request teases apart some of the inter-mingling of concerns in
toolshedandcommon-memory, to fix a bug found in sentry #316When exposed in
toolshed, thecommon-memorycode runs into issues with duplicate request body / json parsing.To fix this bug, and to not run the entire http processing stack twice, I think we should move all of the http handling concerns for the
/api/storage/memoryendpoint up into thetoolshedhono app; and updatecommon-memoryto expose non-http-handling functions forquery, andpatch.Some background on the bug: The
toolshedhono api has openapi request schema validation. The first thing that happens to a request is that it is parsed and validated. This happens to read the request body stream when runningawait request.json(), and then later inside ourtoolshedhandler, we're passing that request object through tomemory.patch(c.req)-- which in turn is running anotherawait request.json(). This is problematic, because you can only read the request body stream once; so thecommon-memorycode was crashing/erroring.Some other things to consider:
common-memory, and one intoolshed, does it make sense to killdeno.tsincommon-memory?